\hypertarget{classsock_1_1net_1_1_reactor}{}\section{sock\+:\+:net\+:\+:Reactor Class Reference}
\label{classsock_1_1net_1_1_reactor}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}


网络反应器  




{\ttfamily \#include $<$reactor.\+h$>$}

Inheritance diagram for sock\+:\+:net\+:\+:Reactor\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classsock_1_1net_1_1_reactor}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197}{Event} \{ \\*
\hyperlink{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a882c20771f64fd23b689438320c1b197}{R\+E\+A\+D} = 0x1, 
\hyperlink{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a98270db6d3ea12747653b0627a514086}{W\+R\+I\+T\+E} = 0x2, 
\hyperlink{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197aa9284f403794613a8347b16c4b806cdd}{E\+R\+R} = 0x4, 
\hyperlink{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a3cf7edae26c7f7b9af0b0f8d9cbc7969}{R\+D\+E\+R\+R} = R\+E\+A\+D $\vert$ E\+R\+R, 
\\*
\hyperlink{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a0e7f9665c5206ccea8e8905e0a603c6a}{W\+R\+E\+R\+R} = W\+R\+I\+T\+E $\vert$ E\+R\+R, 
\hyperlink{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197ac8f0208397c73d7e4e9a353a12e03cae}{R\+D\+W\+R} = R\+E\+A\+D $\vert$ W\+R\+I\+T\+E, 
\hyperlink{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197abb336e4beecd5cb2896e832cecd00ca4}{A\+L\+L} = R\+E\+A\+D $\vert$ W\+R\+I\+T\+E $\vert$ E\+R\+R
 \}\begin{DoxyCompactList}\small\item\em 网络事件类型 \end{DoxyCompactList}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classsock_1_1net_1_1_reactor_a3f7030a8a6230487c674853224ddb915}{Reactor} (void)
\item 
virtual \hyperlink{classsock_1_1net_1_1_reactor_ad616dbb0d11d2d651b5fd244e0e6c609}{$\sim$\+Reactor} (void)
\item 
virtual bool \hyperlink{classsock_1_1net_1_1_reactor_a31ff586f2329ba43e73ea5762b4929e7}{add\+Source} (sock\+\_\+t sock, \hyperlink{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197}{Event} event, \hyperlink{classsock_1_1net_1_1_net_event_handler}{Net\+Event\+Handler} $\ast$handler)=0
\begin{DoxyCompactList}\small\item\em 添加事件源 \end{DoxyCompactList}\item 
virtual void \hyperlink{classsock_1_1net_1_1_reactor_acd768d76883d1217bb4cf10a3820990e}{remove\+Source} (sock\+\_\+t sock)=0
\begin{DoxyCompactList}\small\item\em 移除事件源 \end{DoxyCompactList}\item 
virtual bool \hyperlink{classsock_1_1net_1_1_reactor_a9bbc07e2fca79e7c09a0be3d80d313bd}{add\+Source} (\hyperlink{classsock_1_1net_1_1_socket}{Socket} $\ast$sock, \hyperlink{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197}{Event} event, \hyperlink{classsock_1_1net_1_1_net_event_handler}{Net\+Event\+Handler} $\ast$handler)=0
\begin{DoxyCompactList}\small\item\em 添加事件源 \end{DoxyCompactList}\item 
virtual void \hyperlink{classsock_1_1net_1_1_reactor_add2344de23e45df195bd173d05ba2075}{remove\+Source} (\hyperlink{classsock_1_1net_1_1_socket}{Socket} $\ast$sock)=0
\begin{DoxyCompactList}\small\item\em 移除事件源 \end{DoxyCompactList}\item 
virtual void \hyperlink{classsock_1_1net_1_1_reactor_a479c30f659596b68d0ad820981227ebf}{tick} (int timeout=0)=0
\begin{DoxyCompactList}\small\item\em Tick处理网络事件 \end{DoxyCompactList}\item 
void \hyperlink{classsock_1_1net_1_1_reactor_ac117f6b319f740f26bae2036f2b754d6}{set\+Heartbeat\+Time} (base\+::mtime\+\_\+t time)
\begin{DoxyCompactList}\small\item\em 设置心跳间隔时间 \end{DoxyCompactList}\item 
base\+::mtime\+\_\+t \hyperlink{classsock_1_1net_1_1_reactor_aca3e0bd8eaf38b10118755a5b22fb4c2}{get\+Heartbeat\+Time} (void) const 
\begin{DoxyCompactList}\small\item\em 获取心跳间隔时间 \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
base\+::mtime\+\_\+t \hyperlink{classsock_1_1net_1_1_reactor_ac3d9bb4b0f4988c7c174b2febd239b9a}{heartbeat\+Time\+\_\+}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
网络反应器 

\subsection{Member Enumeration Documentation}
\hypertarget{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197}{}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!Event@{Event}}
\index{Event@{Event}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}
\subsubsection[{Event}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf sock\+::net\+::\+Reactor\+::\+Event}}\label{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197}


网络事件类型 

\begin{Desc}
\item[Enumerator]\par
\begin{description}
\index{R\+E\+A\+D@{R\+E\+A\+D}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!R\+E\+A\+D@{R\+E\+A\+D}}\item[{\em 
\hypertarget{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a882c20771f64fd23b689438320c1b197}{}R\+E\+A\+D\label{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a882c20771f64fd23b689438320c1b197}
}]\index{W\+R\+I\+T\+E@{W\+R\+I\+T\+E}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!W\+R\+I\+T\+E@{W\+R\+I\+T\+E}}\item[{\em 
\hypertarget{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a98270db6d3ea12747653b0627a514086}{}W\+R\+I\+T\+E\label{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a98270db6d3ea12747653b0627a514086}
}]\index{E\+R\+R@{E\+R\+R}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!E\+R\+R@{E\+R\+R}}\item[{\em 
\hypertarget{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197aa9284f403794613a8347b16c4b806cdd}{}E\+R\+R\label{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197aa9284f403794613a8347b16c4b806cdd}
}]\index{R\+D\+E\+R\+R@{R\+D\+E\+R\+R}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!R\+D\+E\+R\+R@{R\+D\+E\+R\+R}}\item[{\em 
\hypertarget{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a3cf7edae26c7f7b9af0b0f8d9cbc7969}{}R\+D\+E\+R\+R\label{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a3cf7edae26c7f7b9af0b0f8d9cbc7969}
}]\index{W\+R\+E\+R\+R@{W\+R\+E\+R\+R}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!W\+R\+E\+R\+R@{W\+R\+E\+R\+R}}\item[{\em 
\hypertarget{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a0e7f9665c5206ccea8e8905e0a603c6a}{}W\+R\+E\+R\+R\label{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197a0e7f9665c5206ccea8e8905e0a603c6a}
}]\index{R\+D\+W\+R@{R\+D\+W\+R}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!R\+D\+W\+R@{R\+D\+W\+R}}\item[{\em 
\hypertarget{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197ac8f0208397c73d7e4e9a353a12e03cae}{}R\+D\+W\+R\label{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197ac8f0208397c73d7e4e9a353a12e03cae}
}]\index{A\+L\+L@{A\+L\+L}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!A\+L\+L@{A\+L\+L}}\item[{\em 
\hypertarget{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197abb336e4beecd5cb2896e832cecd00ca4}{}A\+L\+L\label{classsock_1_1net_1_1_reactor_a47804de81fecd9e153a0893926279197abb336e4beecd5cb2896e832cecd00ca4}
}]\end{description}
\end{Desc}


\subsection{Constructor \& Destructor Documentation}
\hypertarget{classsock_1_1net_1_1_reactor_a3f7030a8a6230487c674853224ddb915}{}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!Reactor@{Reactor}}
\index{Reactor@{Reactor}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}
\subsubsection[{Reactor(void)}]{\setlength{\rightskip}{0pt plus 5cm}sock\+::net\+::\+Reactor\+::\+Reactor (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classsock_1_1net_1_1_reactor_a3f7030a8a6230487c674853224ddb915}
\hypertarget{classsock_1_1net_1_1_reactor_ad616dbb0d11d2d651b5fd244e0e6c609}{}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!````~Reactor@{$\sim$\+Reactor}}
\index{````~Reactor@{$\sim$\+Reactor}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}
\subsubsection[{$\sim$\+Reactor(void)}]{\setlength{\rightskip}{0pt plus 5cm}virtual sock\+::net\+::\+Reactor\+::$\sim$\+Reactor (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}\label{classsock_1_1net_1_1_reactor_ad616dbb0d11d2d651b5fd244e0e6c609}


\subsection{Member Function Documentation}
\hypertarget{classsock_1_1net_1_1_reactor_a31ff586f2329ba43e73ea5762b4929e7}{}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!add\+Source@{add\+Source}}
\index{add\+Source@{add\+Source}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}
\subsubsection[{add\+Source(sock\+\_\+t sock, Event event, Net\+Event\+Handler $\ast$handler)=0}]{\setlength{\rightskip}{0pt plus 5cm}virtual bool sock\+::net\+::\+Reactor\+::add\+Source (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{{\bf Event}}]{event, }
\item[{{\bf Net\+Event\+Handler} $\ast$}]{handler}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [pure virtual]}}\label{classsock_1_1net_1_1_reactor_a31ff586f2329ba43e73ea5762b4929e7}


添加事件源 


\begin{DoxyParams}{Parameters}
{\em sock} & 套接字 \\
\hline
{\em event} & 事件 \\
\hline
{\em handler} & 事件处理器 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
bool 
\end{DoxyReturn}


Implemented in \hyperlink{classsock_1_1net_1_1detail_1_1_e_poll_reactor_a7baa29fa98376bfbecc9847d88a27efe}{sock\+::net\+::detail\+::\+E\+Poll\+Reactor}, and \hyperlink{classsock_1_1net_1_1detail_1_1_select_reactor_ac75c1155ea5633a35bf6756321c054ec}{sock\+::net\+::detail\+::\+Select\+Reactor}.

\hypertarget{classsock_1_1net_1_1_reactor_a9bbc07e2fca79e7c09a0be3d80d313bd}{}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!add\+Source@{add\+Source}}
\index{add\+Source@{add\+Source}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}
\subsubsection[{add\+Source(\+Socket $\ast$sock, Event event, Net\+Event\+Handler $\ast$handler)=0}]{\setlength{\rightskip}{0pt plus 5cm}virtual bool sock\+::net\+::\+Reactor\+::add\+Source (
\begin{DoxyParamCaption}
\item[{{\bf Socket} $\ast$}]{sock, }
\item[{{\bf Event}}]{event, }
\item[{{\bf Net\+Event\+Handler} $\ast$}]{handler}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [pure virtual]}}\label{classsock_1_1net_1_1_reactor_a9bbc07e2fca79e7c09a0be3d80d313bd}


添加事件源 


\begin{DoxyParams}{Parameters}
{\em sock} & 套接字 \\
\hline
{\em event} & 事件 \\
\hline
{\em handler} & 事件处理器 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
bool 
\end{DoxyReturn}


Implemented in \hyperlink{classsock_1_1net_1_1detail_1_1_e_poll_reactor_a9812156dc8da23d27e82e35160cb6cb4}{sock\+::net\+::detail\+::\+E\+Poll\+Reactor}, and \hyperlink{classsock_1_1net_1_1detail_1_1_select_reactor_a3e0f05a7994b016d6012fb353c7a9819}{sock\+::net\+::detail\+::\+Select\+Reactor}.

\hypertarget{classsock_1_1net_1_1_reactor_aca3e0bd8eaf38b10118755a5b22fb4c2}{}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!get\+Heartbeat\+Time@{get\+Heartbeat\+Time}}
\index{get\+Heartbeat\+Time@{get\+Heartbeat\+Time}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}
\subsubsection[{get\+Heartbeat\+Time(void) const }]{\setlength{\rightskip}{0pt plus 5cm}base\+::mtime\+\_\+t sock\+::net\+::\+Reactor\+::get\+Heartbeat\+Time (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classsock_1_1net_1_1_reactor_aca3e0bd8eaf38b10118755a5b22fb4c2}


获取心跳间隔时间 

\begin{DoxyReturn}{Returns}
base\+::mtime\+\_\+t 
\end{DoxyReturn}
\hypertarget{classsock_1_1net_1_1_reactor_acd768d76883d1217bb4cf10a3820990e}{}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!remove\+Source@{remove\+Source}}
\index{remove\+Source@{remove\+Source}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}
\subsubsection[{remove\+Source(sock\+\_\+t sock)=0}]{\setlength{\rightskip}{0pt plus 5cm}virtual void sock\+::net\+::\+Reactor\+::remove\+Source (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [pure virtual]}}\label{classsock_1_1net_1_1_reactor_acd768d76883d1217bb4cf10a3820990e}


移除事件源 


\begin{DoxyParams}{Parameters}
{\em sock} & 套接字 \\
\hline
\end{DoxyParams}


Implemented in \hyperlink{classsock_1_1net_1_1detail_1_1_e_poll_reactor_a2cf3274e515fd1a8f1e109a0f9ac7697}{sock\+::net\+::detail\+::\+E\+Poll\+Reactor}, and \hyperlink{classsock_1_1net_1_1detail_1_1_select_reactor_a3dce50c5abb7c2088dbe3243493f8491}{sock\+::net\+::detail\+::\+Select\+Reactor}.

\hypertarget{classsock_1_1net_1_1_reactor_add2344de23e45df195bd173d05ba2075}{}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!remove\+Source@{remove\+Source}}
\index{remove\+Source@{remove\+Source}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}
\subsubsection[{remove\+Source(\+Socket $\ast$sock)=0}]{\setlength{\rightskip}{0pt plus 5cm}virtual void sock\+::net\+::\+Reactor\+::remove\+Source (
\begin{DoxyParamCaption}
\item[{{\bf Socket} $\ast$}]{sock}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [pure virtual]}}\label{classsock_1_1net_1_1_reactor_add2344de23e45df195bd173d05ba2075}


移除事件源 


\begin{DoxyParams}{Parameters}
{\em sock} & 套接字 \\
\hline
\end{DoxyParams}


Implemented in \hyperlink{classsock_1_1net_1_1detail_1_1_e_poll_reactor_a8ac94101ecd364623c62148117ea2a02}{sock\+::net\+::detail\+::\+E\+Poll\+Reactor}, and \hyperlink{classsock_1_1net_1_1detail_1_1_select_reactor_a57ada1b09454cb4d49463a8f95e7ee00}{sock\+::net\+::detail\+::\+Select\+Reactor}.

\hypertarget{classsock_1_1net_1_1_reactor_ac117f6b319f740f26bae2036f2b754d6}{}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!set\+Heartbeat\+Time@{set\+Heartbeat\+Time}}
\index{set\+Heartbeat\+Time@{set\+Heartbeat\+Time}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}
\subsubsection[{set\+Heartbeat\+Time(base\+::mtime\+\_\+t time)}]{\setlength{\rightskip}{0pt plus 5cm}void sock\+::net\+::\+Reactor\+::set\+Heartbeat\+Time (
\begin{DoxyParamCaption}
\item[{base\+::mtime\+\_\+t}]{time}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classsock_1_1net_1_1_reactor_ac117f6b319f740f26bae2036f2b754d6}


设置心跳间隔时间 


\begin{DoxyParams}{Parameters}
{\em time} & 心跳时间(毫秒) \\
\hline
\end{DoxyParams}
\hypertarget{classsock_1_1net_1_1_reactor_a479c30f659596b68d0ad820981227ebf}{}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!tick@{tick}}
\index{tick@{tick}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}
\subsubsection[{tick(int timeout=0)=0}]{\setlength{\rightskip}{0pt plus 5cm}virtual void sock\+::net\+::\+Reactor\+::tick (
\begin{DoxyParamCaption}
\item[{int}]{timeout = {\ttfamily 0}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [pure virtual]}}\label{classsock_1_1net_1_1_reactor_a479c30f659596b68d0ad820981227ebf}


Tick处理网络事件 


\begin{DoxyParams}{Parameters}
{\em timeout} & 等待超时时间 \\
\hline
\end{DoxyParams}


Implemented in \hyperlink{classsock_1_1net_1_1detail_1_1_e_poll_reactor_a09b95e05048965654a029b529f74d8a0}{sock\+::net\+::detail\+::\+E\+Poll\+Reactor}, and \hyperlink{classsock_1_1net_1_1detail_1_1_select_reactor_a4f46d46b326a7a4f1a88c79032ace5ea}{sock\+::net\+::detail\+::\+Select\+Reactor}.



\subsection{Member Data Documentation}
\hypertarget{classsock_1_1net_1_1_reactor_ac3d9bb4b0f4988c7c174b2febd239b9a}{}\index{sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}!heartbeat\+Time\+\_\+@{heartbeat\+Time\+\_\+}}
\index{heartbeat\+Time\+\_\+@{heartbeat\+Time\+\_\+}!sock\+::net\+::\+Reactor@{sock\+::net\+::\+Reactor}}
\subsubsection[{heartbeat\+Time\+\_\+}]{\setlength{\rightskip}{0pt plus 5cm}base\+::mtime\+\_\+t sock\+::net\+::\+Reactor\+::heartbeat\+Time\+\_\+\hspace{0.3cm}{\ttfamily [protected]}}\label{classsock_1_1net_1_1_reactor_ac3d9bb4b0f4988c7c174b2febd239b9a}


The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
E\+:/git/sock/sock/net/\hyperlink{reactor_8h}{reactor.\+h}\end{DoxyCompactItemize}
